#!/bin/sh
#
# Copyright (c) Nuvoton Technology Corp. All rights reserved.
#
# Read/Write server parameters

eval `/mnt/ESensor/htdocs/proccgi.sh $*`

cd /mnt/ESensor/

#用户配置文件路径
userConfigPath="/mnt/ESensor/etc/"

echo "Content-type: application/json"
echo ""

if [ "$FORM_doAction" == "read" ] ; then

#获取配置信息
varNRF_CH=`cat /mnt/nand1-2/etc/nrf2401 | awk '{print $1;exit}'`

cat << EOF
	{
		"NRF_CH": "$varNRF_CH"
	}
EOF

fi

if [ "$FORM_NRF_CH" == "set" ] ; then
sed "1c $FORM_NNRF_CH " /mnt/nand1-2/etc/nrf2401 -i
varNRF_CH=`cat /mnt/nand1-2/etc/nrf2401 | awk '{print $1;exit}'`
cat << EOF
	{
		"NRF_CH": "$varNRF_CH"
	}
EOF

fi

